package org.langqiao.algorithm;

public class CompetionSelect {
    public static void main(String[] args) {
        int a,b,c,d,e,f,g,h,i,j;
        //1表示参加，0表示不参加
        for(a=0; a<2; a++) 
            for(b=0; b<2; b++)
                for(c=0; c<2; c++)
                    for(d=0; d<2; d++)
                        for(e=0; e<2; e++)
                            for(f=0; f<2; f++)
                                for(g=0; g<2; g++)
                                    for(h=0; h<2; h++)
                                        for(i=0; i<2; i++)
                                            for(j=0; j<2; j++) {
                                                if(a == 1 && b == 1 || a == 0)
                                                    if(c == 0 && d == 0 || c == 1)
                                                        if((a + c) == 1 && (b + d) == 1)
                                                            if((d + e + f + g + h) >= 2)
                                                                if(c == g) 
                                                                    if((c + e + g + i) <= 2)
                                                                        if(e == 1 && f == 1 && g == 1 || e == 0)
                                                                            if(f == 1 && g == 0 && h == 0 || f == 0)
                                                                                if(i == 0 && j == 0 && h == 1 || i == 1 || j == 1)
                                                                                    print(a,b,c,d,e,f,g,h,i,j);
                                            }
    }

    private static void print(int a, int b, int c, int d, int e, int f, int g,
            int h, int i, int j) {
        StringBuffer sb = new StringBuffer();
        if(a == 1) 
            sb.append("A ");
        if(b == 1) 
            sb.append("B ");
        if(c == 1) 
            sb.append("C ");
        if(d == 1) 
            sb.append("D ");
        if(e == 1) 
            sb.append("E ");
        if(f == 1) 
            sb.append("F ");
        if(g == 1) 
            sb.append("G ");
        if(h == 1) 
            sb.append("H ");
        if(i == 1) 
            sb.append("I ");
        if(j == 1) 
            sb.append("J ");
        System.out.println(sb.toString());
    }
}




